﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Real = System.Double;

namespace LinearAlgebra.Vectors.Numeric
{
	public partial class RealVector
	{
		public static RealVector Create( int size, VectorElementFunction vef )
		{
			RealVector u = new RealVector( size );
			for (int i = 0; i < size; i++)			
				u[i] = vef(i);			
			return u;
		}

		public static RealVector Random( int size, int seed, int lower, int upper )
		{
			Random u = new Random( seed );
			return Create( size, (i)=>u.Next( lower, upper ) );			
		}

		public static RealVector Zero( int size ) { return Create( size, i => 0 ); }

		public static RealVector CreateFrom( RealVector u )
		{
			return Create( u.Length, (i)=>u[i] ); //create the new vector 
		}
	}
}
